package com.study.design.pattern.principle.openclone;

import java.math.BigDecimal;

/**
 * @Author: gongsl
 * @Date: 2025-01-11 15:21
 * @description: 课程测试类
 */
public class TestCourse {
    public static void main(String[] args) {
        ICourse pythonCourse = new PythonCourse(98, "python从入门到精通", "Tom", new BigDecimal("399"));
        System.out.println(pythonCourse);

        ICourse javaCourse = new JavaCourse(96, "java从入门到放弃", new BigDecimal("299"));
        System.out.println("java课程id为：" + javaCourse.getId() + "，名称为：" + javaCourse.getName() + "，价格为：" + javaCourse.getPrice() + "元");

        ICourse iCourse = new JavaDiscountCourse(96, "java从入门到放弃", new BigDecimal("299"));
        JavaDiscountCourse javaDiscountCourse = (JavaDiscountCourse) iCourse;
        System.out.println("java课程折扣价格为：" + javaDiscountCourse.getPrice() + "元，原价为：" + javaDiscountCourse.getOriginPrice() + "元");
    }
}
